package com.iwhalecloud.bss.kite.cucc.spec.impl.query;

import com.iwhalecloud.bss.kite.dataservice.api.IQueryProdAttrValueRestrictService;
import com.iwhalecloud.bss.kite.dataservice.entity.spec.ProdAttrValueRestrictInfo;
import com.iwhalecloud.bss.kite.dataservice.mapper.spec.ProdAttrValueRestrictInfoMapper;
import com.ztesoft.bss.base.staticdata.CoreDataOffer;
import com.ztesoft.bss.order.base.consts.IKeyValues;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProdAttrValueRestrictQueryService implements IQueryProdAttrValueRestrictService {

	@Autowired
	private ProdAttrValueRestrictInfoMapper prodAttrValueRestrictInfoMapper;

	@Override
	public List<ProdAttrValueRestrictInfo> listProdAttrValueRestricts(List<String> offerIds, String accessType,
			String funcType, String resourceType, String statusCd) {
		List<ProdAttrValueRestrictInfo> listValueAttrRestrictList = prodAttrValueRestrictInfoMapper
	            .getProdAttrValueRestrictList(offerIds, IKeyValues.PRODUCT_CLASSIFICATION_ACCESS,
	                IKeyValues.PRODUCT_CLASSIFICATION_FUNCTION, IKeyValues.PRODUCT_CLASSIFICATION_RESOURCE,
	                IKeyValues.STATUS_CD_1000);
		return listValueAttrRestrictList;
	}

	@Override
	public List<ProdAttrValueRestrictInfo> listProdAttrValueRestrictsMaxMin(List<String> offerIds, String accessType,
			String funcType, String resourceType) {
		List<ProdAttrValueRestrictInfo> rangeAttrRestrictList = prodAttrValueRestrictInfoMapper
	            .getProdAttrValueRestrictMaxMin(offerIds, IKeyValues.PRODUCT_CLASSIFICATION_ACCESS,
	                IKeyValues.PRODUCT_CLASSIFICATION_FUNCTION, IKeyValues.PRODUCT_CLASSIFICATION_RESOURCE);
		return rangeAttrRestrictList;
	}

	@Override
	public List<ProdAttrValueRestrictInfo> listProdAttrValueRestrictsDefault(List<String> offerIds, String accessType,
			String funcType, String resourceType, String rstrType) {
		List<ProdAttrValueRestrictInfo> defaultAttrRestrictList = prodAttrValueRestrictInfoMapper
	            .getProdAttrValueRestrictDefault(offerIds, IKeyValues.PRODUCT_CLASSIFICATION_ACCESS,
	                IKeyValues.PRODUCT_CLASSIFICATION_FUNCTION, IKeyValues.PRODUCT_CLASSIFICATION_RESOURCE,
	                CoreDataOffer.OFF_C_0031_1300);
		return defaultAttrRestrictList;
	}

	@Override
	public List<ProdAttrValueRestrictInfo> listProdAttrValueRestrictsPayment(List<String> offerIds, String accessType,
			String statusCd) {
		List<ProdAttrValueRestrictInfo> paymentModeCdAttrRestrictList = prodAttrValueRestrictInfoMapper
	            .getProdAttrValueRestrictPayment(offerIds, IKeyValues.PRODUCT_CLASSIFICATION_ACCESS,
	                IKeyValues.STATUS_CD_1000);
		return paymentModeCdAttrRestrictList;
	}

	@Override
	public List<ProdAttrValueRestrictInfo> listProdAttrValueRestrictsStyle(List<String> offerIds, String accessType,
			String funcType, String resourceType, String statusCd) {
		List<ProdAttrValueRestrictInfo> styleAttrRestrictList = prodAttrValueRestrictInfoMapper
	            .getProdAttrValueRestrictStyle(offerIds, IKeyValues.PRODUCT_CLASSIFICATION_ACCESS,
	                IKeyValues.PRODUCT_CLASSIFICATION_FUNCTION, IKeyValues.PRODUCT_CLASSIFICATION_RESOURCE,
	                IKeyValues.STATUS_CD_1000);
		return styleAttrRestrictList;
	}

	@Override
	public List<ProdAttrValueRestrictInfo> listProdAttrValueRestrictByDetail(String offerId, String accessType,
			String statusCd) {
		List<ProdAttrValueRestrictInfo> listValueAttrRestrictList = prodAttrValueRestrictInfoMapper.getProdAttrValueRestrictByDetail(
				offerId, IKeyValues.PRODUCT_CLASSIFICATION_ACCESS, IKeyValues.STATUS_CD_1000);
		return listValueAttrRestrictList;
	}

}
